﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ERPStore.Diagnostics.EventConsumers
{
	public class ImageNotFoundEventConsumer : EventBrokR.IConsumer<ERPStore.Web.Events.ImageBrokenEvent>, IDisposable
	{
		public ImageNotFoundEventConsumer()
		{

		}

		public void Handle(ERPStore.Web.Events.ImageBrokenEvent eventMessage)
		{
			var imageNotFound = new Models.ImageNotFound()
			{
				DocumentId = eventMessage.DocumentId,
				FileName = eventMessage.FileName,
				Reason = eventMessage.Reason,
				UrlSource = eventMessage.UrlSource,
			};

			Services.SignalSender.Current.SendAsync(imageNotFound);
		}

		public void Dispose()
		{
		}
	}
}
